#ifndef MESSAGE_DISPATCHER_H
#define MESSAGE_DISPATCHER_H

#include <set>

#include "Types/AITypes.h"


const double SEND_MESSAGE_NOW = 0;
const int NO_EXTRA_INFO = 0;

class BaseEntity;
struct Message;

class MessageDispatcher
{
private:
	typedef std::set<Message> MessageQueue;
	MessageQueue m_messageQueue;

private:
	MessageDispatcher() {};
	MessageDispatcher(const MessageDispatcher&){};
	MessageDispatcher& operator=(const MessageDispatcher&){};

	void DeliverMessage(BaseEntity* entity, const Message& msg);

public:
	static MessageDispatcher& GetInstance();

	void DispatchMessage(double delay, AITypes::EntityID sender,
		AITypes::EntityID receiver, AITypes::MessageType msg, void* extraInfo);

	void DispatchDelayedMessages();
};

#endif